(function(MM, $, undefined) {
   notUpdatedMessage = function() {
      return '{!$Label.MM_WarnUnsavedData}';
   }

   MM.setDataUpdated = function(updated) {
      window.onbeforeunload = updated ? null : notUpdatedMessage;
   }

   MM.pageHasError = function() {
      return ($('.errorM3').length > 0);
   }

   $(document).ready(function() {
      $(':input',document.form).bind("change", function() {
         MM.setDataUpdated(false);
      });
   });
}(window.MM = window.MM || {}, jQuery));